import request from "@/utils/request";
import { type AuthCode, type publicKey, type loginRequest, type LoginRootObject, type Auth, type LoginModel, type Captcha } from '../model/loginModel'
import http from "@/utils/requestAI";


// 获取图形验证码
// export const authCode = (data:''''): Promise<AuthCode> => request.get('/api/auth/authCode',{params:data})

// 登录
// export const checklogin = (data: LoginForm): Promise<LoginResponse> => request.post('/api/administrator/checklogin', data)

// 获取登录验证码
// export const authCode = (): Promise<AuthCode> => request.get('/api/auth/getCaptcha')
// export const authCode = (): Promise<AuthCode> => request.get('/api/auth/getCaptcha')
export const authCode = () => {
    return http.get('/api/auth/getCaptcha')
}

// 获取公钥
// export const authPublicKey = (): Promise<publicKey> => request.get('/api/auth/publicKey')
export const authPublicKey = () => {
    return http.get('/api/auth/publicKey')
}

// 登录
// export const authLogin = (data:loginRequest):Promise<LoginRootObject> => request.post('/api/auth/login',data) 
export const authLogin = (data: loginRequest) => {
    return http.post<LoginRootObject>('/api/auth/login', data)
}
///////////////////////////////////

//登录
export const login = (data: Auth) => {
    return http.post<LoginModel>('/auth/login', data)
}

//获取公钥
export const getPublicKey = () => {
    return http.get<string>('/auth/publicKey')
}

//获取图形验证码

export const getCaptcha = () => {
    return http.get<Captcha>('/auth/getCaptcha')
}